import java.math.BigInteger;
import java.util.Scanner;

public class demo01 {
    //二进制插入
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int i=sc.nextInt();
        int j=sc.nextInt();
        int num=binInsert(n,m,i,j);
        System.out.println(num);
    }
    public static int binInsert(int n, int m, int j, int i) {
        m<<=j;
        return m|n;
    }
}
